/*
 * (c) 2019 <tanghaifeng-gz@loongson.cn> <pengren.mcu@qq.com>
 *
 * SPDX-License-Identifier:	GPL-2.0+
 *
 */

#ifndef __LS3A4000_7A1000_LT_D4000_V102_CONFIG_H
#define __LS3A4000_7A1000_LT_D4000_V102_CONFIG_H

#define CONFIG_RECOVER

#include "ls3a_common.h"

/* Loongson bootelf bootparam smbios */
#define CONFIG_LOONGSON_BOARD_NAME "LS3A4000-7A1000-LT-D4000-V102"

#undef CPU_CLOCK_RATE
#define CPU_CLOCK_RATE    1200000000

/* Framebuffer and LCD */
#if defined(CONFIG_VIDEO_LS1X)
//#define LOONGSON_USED_GMEM
#define LS1X_DC0
//#define LS1X_DC0_USE_DEMODE
#define LS1X_DC1
#define LS1X_DC1_USE_DEMODE
#define LS1X_DC_MAX 2
#endif

#define	CONFIG_EXTRA_ENV_SETTINGS					\
	CONSOLE_STDOUT_SETTINGS \
	"loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
	"fdt_addr=" __stringify(FDT_LOAD_ADDR) "\0" \
	"rd_start=" __stringify(RAMDISK_START) "\0" \
	"rd_size=" __stringify(RAMDISK_SIZE) "\0" \
	"mtdids=" CONFIG_MTDIDS_DEFAULT "\0"					\
	"mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0"				\
	"splashpos=m,m\0" \
	"video=" "VGA-1:800x600-32@60 video=VGA-2:800x600-32@60" "\0" \
	"panel0=" "vesa800x600@60" "\0" \
	"panel1=" "vesa800x600@60" "\0" \
	"root_dev=sda\0" \
	"rootpart=1\0" \
	"syspart=1\0" \
	"update=1\0" \
	"menucmd=bootmenu\0" \
	"bootmenu_0=System boot select=updatemenu bootselect 1\0" \
	"bootmenu_1=Update kernel=updatemenu kernel 1\0" \
	"bootmenu_2=Update u-boot=updatemenu uboot 1\0" \
	"bootmenu_3=Update DTB=updatemenu dtb 1\0" \
	"bootmenu_4=System install or recover=updatemenu system 1\0" \
	"bootmenu_delay=10\0" \

/* Boot beep */
#define BEEP_GPIO 32 //ls7a1000 gpio0脚

#define CONFIG_WATCHDOG_TIMEOUT_MSECS	(30 * 1000)

/* 外部看门狗 */
/* WatchDog Close for CPLD*/
#define WatchDog_Close \
GPIO_SET_OUTPUT(0x1<<13);\
li v1,0x100;\
78:; \
subu v1,1; \
bnez v1,78b; \
nop;
/* WatchDog Enable for CPLD*/
#define WatchDog_Enable \
GPIO_CLEAR_OUTPUT(0x1<<13);\
li v1,0x100;\
78:; \
subu v1,1; \
bnez v1,78b; \
nop;

//ddr时钟相位调整0x038(dll_clock) 范围0x00~0x7f
#define NODE0_MC0_CLK   0x154
#define NODE0_MC1_CLK   0x154

#endif	/* __LS3A4000_7A1000_LT_D4000_V102_CONFIG_H */
